package com.hgyc.mom.eam.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hgyc.mom.common.vo.Result;
import com.hgyc.mom.core.mybatis.QueryWrapperUtil;
import com.hgyc.mom.eam.entity.EamCheckReportLine;
import com.hgyc.mom.eam.service.EamCheckReportLineService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 设备点检记录Controller
 *
 * @author fwj
 * @since 2025-08-14
 */
@Tag(name = "设备点检记录控制器", description = "设备点检记录控制器")
@RestController
@RequestMapping("/eam/checkReport/line")
public class EamCheckReportLineController {
    @Autowired
    private EamCheckReportLineService eamCheckReportLineService;


    @Operation(summary = "查询设备点检记录树列表", description = "查询设备点检记录树列表")
    @PostMapping("/list")
    public Result<List<EamCheckReportLine>> pageList(@Parameter(description = "查询参数") @RequestBody EamCheckReportLine eamCheckReportLine) {
        QueryWrapper<EamCheckReportLine> wrapper = QueryWrapperUtil.build(eamCheckReportLine);
        List<EamCheckReportLine> list = eamCheckReportLineService.list(wrapper);
        return Result.success(list);
    }

    @Operation(summary = "获取设备点检记录详细信息", description = "获取设备点检记录详细信息")
    @GetMapping(value = "/{id}")
    public Result<EamCheckReportLine> getInfo(@Parameter(description = "设备点检记录ID") @PathVariable("id") Long id) {
        return Result.success(eamCheckReportLineService.getById(id));
    }

}
